home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / zcpp_jae.zip / TEMPSAMP.I < prev   
Text File  |  1990-07-10  |  644b  |  47 lines

  1. #line 1 "template-sample.c"
  2.  
  3.  
  4.  
  5.  
  6. #line 28 "template-sample.c"
  7. extern void* error (char*);
  8.  
  9. ;
  10.  
  11. ;
  12.  
  13. ;
  14.  
  15.  
  16.  
  17.  
  18. typedef char* charP;
  19.  
  20. #line 30 "template-sample.c"
  21.  
  22. class Vector_charP {
  23. charP* v;
  24. int sz;
  25. public:
  26. Vector_charP(int);
  27. charP& operator[](int);
  28. inline charP& elem(int i) { return v[i]; }
  29. };
  30. #line 52 "template-sample.c"
  31. ;
  32.  
  33. #line 40 "template-sample.c"
  34. charP& Vector_charP::operator[](int i)
  35. {
  36. if (i<0 || sz<=i) error("vector: range error");
  37. return elem(i);
  38. }
  39. #line 47 "template-sample.c"
  40. Vector_charP::Vector_charP(size)
  41. {
  42. v = new(charP[size]);
  43. }
  44. #line 53 "template-sample.c"
  45. ;
  46. Vector_charP vs(30);
  47.